package lab2;

public class ApplicationFramework {
    private AbstractFactory factory;
    private Dataset dataset;
    private Optimizer optimizer;
    private LossFunction lossFunction;
    public void selectFactory(String str){
        this.factory = Helper.getFactory(str);
    }

    public void dataProcess(){
        System.out.println("1:Process dataset：");
        dataset = factory.createDataset();
        dataset.dataProcess();
    }

    public void designNetworkStructure(){
        System.out.println("2:Design model：");
        Layer layer1 = factory.createLayer();
        Layer layer2 = factory.createLayer();
        Layer layer3 = factory.createLayer();
        layer1.connect(layer2);
        layer2.connect(layer3);
    }

    public void trainingConfig(){
        System.out.println("3:Training Config：");
        optimizer = factory.createOptimizer();
        lossFunction = factory.createLossFunction();

    }

    public void formallyTrained(){
        System.out.println("4.Formally trained:");
        lossFunction.calGap();
        optimizer.applyOptimizer();
    }

    public void saveModel(){
        System.out.println("5.Save model.");
        factory.createModel().save();
    }

    public void applyModel(){
        System.out.println("6.Apply model.");
    }
}
